package com.ali.ttt.netty.cluster.config;

import com.ali.ttt.netty.client.config.NettyClient;
import com.ali.ttt.netty.common.domain.Client;
import com.ali.ttt.netty.common.domain.Message;
import com.ali.ttt.netty.common.utils.MessageUtil;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.EventLoop;
import io.netty.util.concurrent.GenericFutureListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @Author : yuxl
 * @create 2024/7/5 5:09 PM
 */
@Slf4j
@Configuration
@ConditionalOnProperty(name = "netty.cluster.enable", havingValue = "true")
public class ClusterStarter {

    @Resource
    private NettyCluster nettyCluster;


    @PostConstruct
    public void run() throws UnknownHostException {
        nettyCluster.start();
    }
}
